package com.itheima.controller;

import com.itheima.pojo.ClazzOption;
import com.itheima.pojo.Result;
import com.itheima.service.ClazzOptionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@Slf4j
@RequestMapping("/report")
public class ClazzOptionController {

    @Autowired
    private ClazzOptionService clazzOptionService;

    /****
     * 统计每一个班级的人数
     * @return
     */
    @GetMapping("/studentCountData")
    public Result getClazzCountData(){
        ClazzOption clazzOption = clazzOptionService.getClazzCountData();
        return Result.success(clazzOption);
    }

    /***
     * 统计学员的学历信息
     * @return
     */
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeCount(){
        List<Map> list = clazzOptionService.getStudentDegreeCount();
        return Result.success(list);
    }
}
